package de.dhbw.karlsruhe.picsim.model.commands.impl;

import de.dhbw.karlsruhe.picsim.model.actions.ActionFactory;
import de.dhbw.karlsruhe.picsim.model.actions.PicAction;
import de.dhbw.karlsruhe.picsim.model.memory.RegisterValue;
import de.dhbw.karlsruhe.picsim.model.memory.impl.RegisterValueImpl;
import de.dhbw.karlsruhe.picsim.util.Bits;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: goesen
 * Date: May 3, 2010
 * Time: 1:26:21 PM
 */
public class MovWF extends InstructionSupport {
    private static final Log log = LogFactory.getLog(MovWF.class);

    public MovWF(final Bits argument) {
        super(false, false, argument);
    }

    @NotNull
    @Override
    protected RegisterValue getValue(@NotNull final RegisterValue addressedFile, @NotNull final RegisterValue wRegister,
                                     @NotNull final List<PicAction> yourActions,
                                     @NotNull final ActionFactory actionFactory) {
        log.debug("MovWF gets executed");
        final int wFile = wRegister.asInteger();
        final int result = wFile;
        log.debug("Result is = " + result);
        return RegisterValueImpl.createUnsafe(result);
    }
}
